const express = require("express");
const session = require("express-session");
var app = express();

app.keys = ['www.ydoo.cn/zhiweibao'];

const CONFIG = {
    key: 'ydoo:sess', //cookie key (default is koa:sess)
    maxAge: 8640000, // cookie的过期时间 maxAge in ms (default is 1 days)
    autoCommit: true,
    overwrite: true, //是否可以overwrite 
    httpOnly: true, //cookie是否只有服务器端可以访问 httpOnly or not (default true)
    signed: true, //签名默认true
    rolling: false, //在每次请求时强行设置cookie，这将重置cookie过期时间（默认：false）
    renew: false, //(boolean) renew session when session is nearly expired,
    secure: true,
    sameSite: null,
};

app.use(session(CONFIG, app));

module.exports = app;